Skip to content

Comments

Fix Process resource leak in system metrics collection#17212

Open
PDGGK wants to merge 1 commit intoapache:masterfrom
PDGGK:fix-process-resource-leak-metrics
Open

Fix Process resource leak in system metrics collection#17212
PDGGK wants to merge 1 commit intoapache:masterfrom
PDGGK:fix-process-resource-leak-metrics

Conversation

@PDGGK
Copy link

@PDGGK PDGGK commented Feb 22, 2026

Summary

  • Add process.waitFor() and process.destroyForcibly() in finally block to prevent zombie processes in periodic metrics collection
  • Handle InterruptedException properly by restoring the interrupt flag
  • Fixes both SystemMetrics (memory) and LinuxNetMetricManager (socket count)

Fixes #17211

Test plan

  • Code compiles
  • CI checks

Add process.waitFor() and process.destroyForcibly() in finally block
to prevent zombie processes when collecting system memory and network
metrics via Runtime.exec(). Also handle InterruptedException properly
by restoring the interrupt flag.

Affected files:
- SystemMetrics: memory info collection via 'free' command
- LinuxNetMetricManager: socket count collection via 'ss' command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Process resource leak in system metrics collection (SystemMetrics and LinuxNetMetricManager)

1 participant